<?php

/**
 * Tache filter form base class.
 *
 * @package    tfe
 * @subpackage filter
 * @author     3emeIG
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseTacheFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_contact'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RelativeAUnePersonne'), 'add_empty' => true)),
      'id_groupe'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RelativeAUnGroupe'), 'add_empty' => true)),
      'responsable' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Responsable'), 'add_empty' => true)),
      'type'        => new sfWidgetFormChoice(array('choices' => array('' => '', 'Communication' => 'Communication', 'Organisation d\'évènement' => 'Organisation d\'évènement', 'Administratif' => 'Administratif', 'Réunion' => 'Réunion', 'Autre' => 'Autre'))),
      'date'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'heure'       => new sfWidgetFormFilterInput(),
      'priorite'    => new sfWidgetFormChoice(array('choices' => array('' => '', 'Urgent' => 'Urgent', 'Prioritaire' => 'Prioritaire', 'Normale' => 'Normale', 'Faible' => 'Faible'))),
      'effectue'    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'commentaire' => new sfWidgetFormFilterInput(),
      'deleted_at'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'created_at'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'id_contact'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('RelativeAUnePersonne'), 'column' => 'id')),
      'id_groupe'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('RelativeAUnGroupe'), 'column' => 'id')),
      'responsable' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Responsable'), 'column' => 'id')),
      'type'        => new sfValidatorChoice(array('required' => false, 'choices' => array('Communication' => 'Communication', 'Organisation d\'évènement' => 'Organisation d\'évènement', 'Administratif' => 'Administratif', 'Réunion' => 'Réunion', 'Autre' => 'Autre'))),
      'date'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'heure'       => new sfValidatorPass(array('required' => false)),
      'priorite'    => new sfValidatorChoice(array('required' => false, 'choices' => array('Urgent' => 'Urgent', 'Prioritaire' => 'Prioritaire', 'Normale' => 'Normale', 'Faible' => 'Faible'))),
      'effectue'    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'commentaire' => new sfValidatorPass(array('required' => false)),
      'deleted_at'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'created_at'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('tache_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Tache';
  }

  public function getFields()
  {
    return array(
      'id'          => 'Number',
      'id_contact'  => 'ForeignKey',
      'id_groupe'   => 'ForeignKey',
      'responsable' => 'ForeignKey',
      'type'        => 'Enum',
      'date'        => 'Date',
      'heure'       => 'Text',
      'priorite'    => 'Enum',
      'effectue'    => 'Boolean',
      'commentaire' => 'Text',
      'deleted_at'  => 'Date',
      'created_at'  => 'Date',
      'updated_at'  => 'Date',
    );
  }
}
